package com.hgy.crowd.api;

import com.hgy.crowd.po.MemberPO;
import com.hgy.crowd.util.ResultEntity;
import com.hgy.crowd.vo.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @Author He
 * @Date 2020/6/30 16:54
 */
@FeignClient("hgy-crowd-mysql")
public interface MySQLRemoteService {
    /**
     * 通过远程调用方法，获取会员信息
     * @param account
     * @return
     */
    @RequestMapping("/get/member/by/account/remote")
    ResultEntity<MemberPO> getMemberByLoginAccountRemote(@RequestParam("account") String account);

    /**
     * 添加新注册的用户
     * @param memberPO
     * @return
     */
    @RequestMapping("/save/member")
    ResultEntity saveMember(@RequestBody MemberPO memberPO);

    /**
     * 将projectVO中的信息添加到数据库
     * @param tempProject
     * @param memberId
     * @return
     */
    @RequestMapping("/save/project/vo")
    ResultEntity<String> saveProjectVORemote(@RequestBody ProjectVO tempProject, @RequestParam("memberId") Integer memberId);

    @RequestMapping("/get/portal/type/project/data/remote")
    ResultEntity<List<PortalTypeVO>> getPortalTypeProjectDataRemote();

    @RequestMapping("/get/project/detail/remote/{projectId}")
    ResultEntity<DetailProjectVO> getDetailProjectVORemote(@PathVariable("projectId") Integer projectId);

    @RequestMapping("/get/order/project/vo/remote")
    ResultEntity<OrderProjectVO> getOrderProjectVORemote(@RequestParam("projectId") Integer projectId, @RequestParam("returnId") Integer returnId);

    @RequestMapping("/get/address/vo/remote")
    ResultEntity<List<AddressVO>> getAddressVORemote(@RequestParam("memberId") Integer memberId);

    @RequestMapping("/save/address/remote")
    ResultEntity<String> saveAddressRemote(@RequestBody AddressVO addressVO);

    @RequestMapping("/save/order/remote")
    ResultEntity<String> saveOrderRemote(@RequestBody OrderVO orderVO);
}
